//楼栋查询
var app = new Vue({
	el: '.row',
	data: {
		userList:[],
		ProductActive:"",
		ProductActive1:"",
		ProductActive2:"",
		userList1:[],
		userList2:[],
		flag : true,
		flag1 : false,
		flag2 : false,
		flag3 : false,
		flag4 : false,
		flag5 : false,
		flag6 : false,
		miaosu : "",
		xiangxi : "",
		file: "",
	},
	created(){
		this.getList()
	},
	methods:{
		getList(){
			axios.post("xiuli/loudong",headers:{"token":localStorage.token,"url":window.location.pathname})
				.then(response => {
					this.userList = response.data.data
					console.log(this.userList)
				})
				.catch()
				
				
		},
		changeProduct(event) {
             this.ProductActive = event.target.value; //获取option对应的value值
             console.log("你选中了",this.ProductActive)
			let data=new URLSearchParams;
			data.append("id",this.ProductActive);
			 axios({
				 method : "post",
				 url : "xiuli/louceng",
				 data : data,
				 headers:{"token":localStorage.token,"url":window.location.pathname}
			 }).then(response =>{
				 
				 this.userList1 = response.data.data;
				 console.log(this.userList1)
			 })
        },changeProduct1(event) {
             this.ProductActive1 = event.target.value; //获取option对应的value值
             console.log("你选中了",this.ProductActive1)
			let data=new URLSearchParams;
			data.append("id",app.ProductActive1);
			 axios({
				 method : "post",
				 url : "xiuli/fangjian",
				 data : data,
				 headers:{"token":localStorage.token,"url":window.location.pathname}
			 }).then(response =>{
				 
				 this.userList2 = response.data.data;
				 console.log(this.userList2)
			 })
        },changeProduct2(event){
			this.ProductActive2=event.target.value;
			console.log("你选中了",this.ProductActive2);
		},show(){
			this.flag =!this.flag
		},tijiao(){
			 this.flag1=false;
			 this.flag2=false;
			 this.flag3=false;
			 this.flag4=false;
			 this.flag5=false;
			 this.flag6=false;
			 if(this.xiangxi==null || this.xiangxi==''){
				 this.flag6=true;
				 if(this.ProductActive==null ||this.ProductActive==''){
				 	this.flag1=true;
				 	return;
				 }else if(this.ProductActive1==null ||this.ProductActive1==''){
				 	
				 	this.flag2=true;
				 	return;
				 }else if(this.ProductActive2==null ||this.ProductActive2==''){
				 	this.flag3=true;
				 	return;
				 }
			 }
			if(this.miaosu==null ||this.miaosu==''){
				this.flag4=true;
				return;
			}else if(this.file==null ||this.file==''){
				this.flag5=true;
				return;
			}
			let data = new FormData();
			if(this.xiangxi==null||this.xiangxi==''){
			data.append("detailedAddress",this.ProductActive+"栋"+this.ProductActive1+"楼"+this.ProductActive2+"房");
			}else{
				data.append("detailedAddress",this.xiangxi);
			}
			data.append("describe",this.miaosu);
			data.append("file",this.file[0]);
			axios({
				method: "post",
				url : "xiuli/maintain",
				data : data,
				headers:{"token":localStorage.token,"url":window.location.pathname}
			}).then()
		},getFile(e){
			this.file=e.target.files;
			console.log(this.file);
			
		}
		
		
	}
})



